package calendar.commands.calendar;

import calendar.commands.CalendarCommand;
import calendar.view.panels.CalendarGridPanel;
import com.google.api.services.calendar.model.Calendar;
import swing.Dialog;

public class UpdateCalendar extends CalendarCommand<Calendar> {

    public UpdateCalendar(com.google.api.services.calendar.Calendar client) {
        super(client);
    }

    @Override
    protected void protectedExecute() throws Exception {
        Calendar entry = new Calendar();
        entry.setSummary("Updated Calendar for Testing");
        Calendar result = client.calendars().patch(calendar.getId(), entry).execute();
        Dialog.popup(new CalendarGridPanel(result));
        setResult(result);
    }
}
